package com.github.livebase.util;

import com.github.livebase.util.base.Assert;
import com.github.livebase.util.base.ObjectsUtil;

import java.util.Map;

/**
 * @ClassName PairsUtil
 * @description:
 * @author: biao532
 * @create: 2024-02-17 14:51
 * @Version 1.0
 **/
public class PairsUtil {
    public static void pairsInsertMap(Map<String, String> map, String value, String delimiter) {
        Assert.notNull(map);
        Assert.notNull(value);
        Assert.notNull(delimiter);
        int idx = value.indexOf(delimiter);
        if (idx == -1) {
            map.put(value, ObjectsUtil.Empty.STRING);
            return;
        }
        map.put(value.substring(0, idx), value.substring(idx + delimiter.length()));
    }
}
